//
//  ViewController.m
//  QrCode
//
//  Created by 陈光 on 2017/11/3.
//  Copyright © 2017年 陈光. All rights reserved.
//

#import "ViewController.h"
#import "BaseViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(100, 200, 170, 40);
    [btn setTitle:@"开启定位服务" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(openSet) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    
    BaseViewController *baseVC = [[BaseViewController alloc] init];
    
    
}

- (void)openSet
{
    
    [self openWiFi];
    
//    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    
//    NSURL *url = [NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"];
//    if ([[UIApplication sharedApplication] canOpenURL:url]) {
//        [[UIApplication sharedApplication] openURL:url];
//    }
}

- (void)openWiFi {
    NSURL *url = [NSURL URLWithString:@"Prefs:root=WIFI"];
    if ([[UIApplication sharedApplication] canOpenURL:url]) {
        // 系统的Wi-Fi界面
        [[UIApplication sharedApplication] openURL:url];
    } else {
        // 系统大于10的时候直接打开当前App的设置界面
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
